<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<title>宝宝资料</title>
		<link rel="stylesheet" href="../../css/base.css" />
		<link rel="stylesheet" href="../../css/common.css" />
		<!-- Bootstrap Core CSS -->
		<link href="../../sbadmin/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
		<!-- MetisMenu CSS -->
		<link href="../../sbadmin/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
		<!-- DataTables CSS -->
		<link href="../../sbadmin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">
		<!-- Custom CSS -->
		<link href="../../sbadmin/dist/css/sb-admin-2.css" rel="stylesheet">
		<!-- Custom Fonts -->
		<link href="../../sbadmin/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]> 
	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
	<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
		<style>
			body {
				padding: 0 15px !important;
			}
		</style>
	</head>

	<body style="background:#FFF;">
		<div class="comm-tt-font pr">
			会员信息 > 会员详情
		</div>
		<div class="zl-ccbox">
			<div class="zl-cctt pr">
				<ul class="zl-list-ul clb">
					<li>
						<a href="personalMsg.html">个人资料</a>
					</li>
					<li>
						<a href="babyMsg.html" class="cur">宝宝资料</a>
					</li>
					<li>
						<a href="order.html">订单</a>
					</li>
				</ul>
				<a href="addBabyMsg.html" class="bb-add">添加宝宝</a>
			</div>
		</div>
		<div class="bblist"></div>
		<!-- jQuery -->
		<script src="../../sbadmin/bower_components/jquery/dist/jquery.min.js"></script>
		<!-- Bootstrap Core JavaScript -->
		<script src="../../sbadmin/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<!-- Metis Menu Plugin JavaScript -->
		<script src="../../sbadmin/bower_components/metisMenu/dist/metisMenu.min.js"></script>
		<!-- DataTables JavaScript -->
		<script src="../../sbadmin/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
		<script src="../../sbadmin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
		<!-- Custom Theme JavaScript -->
		<script src="../../sbadmin/dist/js/sb-admin-2.js"></script>
		<script src="../../js/layer/layer.js"></script>
		<script type="text/javascript" src="../../js/common.js"></script>
		<!-- Page-Level Demo Scripts - Tables - Use for reference -->
	</body>
	<script>
		$(function() {
			var isType = localStorage.getItem("isType");
			if(isType != "1") {
				$(".bb-add").hide();
			}
			var id = localStorage.getItem("id", id);
			var post_data = {
				"userId": id
			}
			$.ajax({
				url: "https://order.wz1996.wang/wzbg/kid/query",
				type: 'post',
				contentType: 'application/json',
				data: JSON.stringify(post_data),
				beforeSend: function(request) {
					request.setRequestHeader("token", localStorage.getItem("token"));
				},
				success: function(data) {
					console.log(data);
					if(data.code == "1") {
						var html = "";
						var skid = data.data.kid;
						for(var i = 0; i < data.data.kid.length; i++) {
							html += "<div class='baby-msgbox pr'>";
							if(isType != "1") {
								html += "";
							} else {
								html += "<a href='editBabyMsg.html' class='pm-edit-btn' id=" + skid[i].id + ">修改宝宝资料</a>";
							}

							html += "<div class='bb-name'>" + skid[i].name + "</div>";
							html += "<div class='clb mt15 mb5'>";
							html += "<div class='bb-item fl'>宝宝ID：</div>"
							html += "<div class='bb-itemcc fl'>" + skid[i].id + "</div>"
							html += "</div>";
							html += "<div class='clb mt15 mb5'>";
							html += "<div class='bb-item fl'>小名：</div>"
							html += "<div class='bb-itemcc fl'>" + skid[i].alias + "</div>"
							html += "</div>";
							html += "<div class='clb mt15 mb5'>";
							html += "<div class='bb-item fl'>性别：</div>"
							if(skid[i].sex == "1") {
								html += "<div class='bb-itemcc fl'>男</div>"
							} else if(skid[i].sex == "0") {
								html += "<div class='bb-itemcc fl'>女</div>"
							} else {
								html += "<div class='bb-itemcc fl'></div>"
							}
							html += "</div>";
							html += "<div class='clb mt15 mb5'>";
							html += "<div class='bb-item fl'>生日：</div>"
							var bbBir = skid[i].birthday;
							html += "<div class='bb-itemcc fl'>" + bbBir.split(" ")[0] + "</div>"
							html += "</div>";
							html += "<div class='clb mt15 mb5'>";
							html += "<div class='bb-item fl'>关联的订单号：</div>"
							html += "<div class='bb-itemcc fl' style='width:200px;height:auto'>";
							for(var j = 0; j < skid[i].orders.length; j++) {
								if(skid[i].orders[j].code == null || skid[i].orders[j].code == "" || skid[i].orders[j].code == undefined) {
									html += "<div style='margin-right:20px'></div>";
								} else {
									html += "<div style='margin-right:20px'>" + skid[i].orders[j].code + "</div>";
								}

							}
							html += "</div>";
							html += "</div>";
							html += "</div>";
						}
						$(".bblist").html(html);
					} else if(data.code == "-1") {
						layar(data.msg);
						setTimeout("window.parent.frames.location.href='/xcxadmin/login.html'", 1000)
					} else {
						layar(data.msg);
					}
				},
				error: function(e) {
					errcode(e);
				}
			});
			$(".bblist").on("click", ".pm-edit-btn", function() {
				var bbId = $(this).attr("id");
				localStorage.setItem("bbId", bbId);
			})

		})
	</script>

</html>